import sqlite3 as sql
import re
f=open('test.csv','r')
s = ""
lst = []
while 1:
    try:
        s = f.readline()
    except EOFError:
        break
    s = re.split("[,\n]",s)
    if s[0] == '':
        break
    s[0] = float(s[0])
    s[1] = float(s[1])
    s[2] = int(s[2])
    s[3] = int(s[3])
    s[4] = float(s[4])
    s.remove('')
    s = tuple(s)
    lst.append(s)
db = sql.connect('task-db')
cursor = db.cursor()
reCount = cursor.execute("""CREATE TABLE task ( pc float,pm float,pn int,itertime int,result float);""")
reCount = cursor.executemany('INSERT INTO task(pc,pm,pn,itertime,result) VALUES(?,?,?,?,?);',lst)
db.commit()
cursor.close()
db.close()
